<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" 
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="livcos.org/ns/cosmos"
	xmlns:job="livcos.org/ns/process/job"
	xmlns:f="livcos.org/ns/xslt/function"
	exclude-result-prefixes="job c f">
  
	<xsl:import href="../../style/base.xsl"/>
	<xsl:import href="../../style/web.xsl"/>
	
	<xsl:param name="objUri" select="$callerObjId"/>
	
	<xsl:variable name="webUri" select="resolve-uri('../..')"/>
	<xsl:variable name="dataObjUri">
		<xsl:variable name="_d" select="f:find-object('/', $callerObjId, 'data')"/>
		<xsl:choose>
			<xsl:when test="$_d != ''">
				<xsl:value-of select="resolve-uri($objUri, concat($_d, '/dummy'))"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="resolve-uri($objUri, $callerObjId)"/>
			</xsl:otherwise>
		</xsl:choose>		
	</xsl:variable>
	
  <xsl:template match="/">
    <html>
      <head>
        <title>Object Missing</title>
      	<meta name="to-root-path" content="{$toRootPath}"/>
      	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      	<link href="{f:caller-uri($webUri, 'css/global.css')}" rel="stylesheet" type="text/css"/>
      	<link href="{f:caller-uri($webUri, 'css/web.css')}" rel="stylesheet" type="text/css"/>
      	<link href="{f:caller-uri($webUri, 'css/gui.css')}" rel="stylesheet" type="text/css"/>
      	<link href="{f:caller-uri($webUri, 'css/status.css')}" rel="stylesheet" type="text/css"/>
      	<link href="{f:caller-uri($webUri, 'css/webXml.css')}" rel="stylesheet" type="text/css"/>
      	<script type="text/javascript" src="{f:caller-uri($webUri, 'script/util.js')}"><xsl:comment> </xsl:comment></script>
      	<script type="text/javascript" src="{f:caller-uri($webUri, 'script/E.js')}"><xsl:comment> </xsl:comment></script>
      	<script type="text/javascript" src="{f:caller-uri($webUri, 'script/init.js')}"><xsl:comment> </xsl:comment></script>
      	<script type="text/javascript" src="{f:caller-uri($webUri, 'script/doc.js')}"><xsl:comment> </xsl:comment></script>
      	<script type="text/javascript" src="{f:caller-uri($webUri, 'script/gui.js')}"><xsl:comment> </xsl:comment></script>
      	<script type="text/javascript" src="{f:caller-uri($webUri, 'script/creator.js')}"><xsl:comment> </xsl:comment></script>
      </head>
      <body>
      	<h1>Object missing for URI: <a href="{f:caller-uri($requestPath)}">
            <xsl:value-of select="$requestPath"/>
          </a>!</h1>
        <p style="font-size: 80%"><a href="{$toRootPath}/sysjob.html?job={$jobId}">See job protocol...</a></p>
        <div style="background-color: LightBlue; padding: 6px 4px; margin: 10px 0px;">
          <p>You can create a new object.</p>
          <form>
            <table style="width: 98%">
              <tbody>
                <tr>
                  <td style="width: 10%; text-align: right; margin-right: 4px;">Object:</td>
                  <td>
                    <div style="position: relative;">
                      <input name="objId" id="objId" type="text" value="{$dataObjUri}" style="width:80%"/>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td style="width: 10%; text-align: right; margin-right: 4px;">Template:</td>
                  <td>
                    <div style="position: relative;">
                      <input name="tmplId" id="tmplId" type="text" value="/livcos.org/type/template/livcos.org/ns/doc/document" style="width:80%"/>
                    	[<a href="javascript:setTmpl('/livcos.org/type/template/livcos.org/ns/doc/document')"
                    		title="A document with a chapter.">Doc</a>]
                    	[<a href="javascript:setTmpl('/livcos.org/type/template/livcos.org/ns/map/map')"
                    		title="A Web Map.">Map</a>]
                    	[<a href="javascript:setTmpl('/livcos.org/type/template/livcos.org/ns/doc/diagram/document')"
                    		title="A document with a diagram.">Diagram</a>]
                    </div>
                  </td>
                </tr>
                <tr>
                  <td colspan="2">
										<p>
											<input type="button" value="create" onclick="createObject()"/>
											<input type="button" value="create &amp; open" onclick="createObject(true)"/>
										</p>
                  </td>
                </tr>
              </tbody>
            </table>
          </form>
          <p id="message" style="display: none"> </p>
          <div id="response" style="display: none; background-color: white;"/>
        </div>
      </body>
    </html>
  </xsl:template>
  
</xsl:stylesheet>